<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Vuex-state</title>
<script src="./../../node_modules/vue/dist/vue.js"></script>
<script src="./../../node_modules/vuex/dist/vuex.min.js"></script>
</head>
<body>
<div id="app">
	<h2>{{msg}}</h2>
	<counter></counter>
</div>
<script>
	const counter = {
		template:`
           <div>{{count}}</div>
		`,
		computed:{
			count(){
				return this.$store.state.count
			}
		}
	}
	const storeVuex = new Vuex.store({
        state:{
        	count:0
        }
	});
	new Vue({
		el:"#app",
		store:storeVuex,
		data:{
			msg:"Vuex的使用"
		},
		components:{
			counter
		}
	})
</script>
</body>
</html>